package com.nervenets.shopping.controller.user.dto;

import com.nervenets.general.Global;
import com.nervenets.general.utils.HttpTools;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;

import javax.servlet.http.HttpServletRequest;
import java.io.Serializable;

@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class LoginInfoVo implements Serializable {
    private String platformValue;
    private String ip;
    private String userAgent;
    private String license;

    public LoginInfoVo(HttpServletRequest request) {
        this.platformValue = request.getHeader(Global.Constants.PLATFORM_KEY);
        this.ip = HttpTools.getIpAddress(request);
        this.userAgent = request.getHeader("User-Agent");
    }
}
